Prioritizing garbage collection and block allocation based on I/O history for logical address regions

ABSTRACT

Systems, methods and/or devices are used to enable prioritizing garbage collection and block allocation based on I/O history for logical address regions. In one aspect, the method includes (1) receiving, at a storage device, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host, (2) in accordance with the plurality of I/O requests over a predetermined time period, identifying an idle region of the plurality of regions in the logical address space of the host, and (3) in accordance with the identification of the idle region, enabling garbage collection of data storage blocks, in the storage device, that store data in the idle region.

RELATED APPLICATIONS

This application claims priority to U.S. Provisional Patent Application Ser. No. 62/009,139, filed Jun. 6, 2014, entitled “Prioritizing Garbage Collection and Block Allocation Based on I/O History for Logical Address Regions,” and further claims priority to (1) U.S. Provisional Patent Application Ser. No. 62/005,405, filed May 30, 2014, entitled “Real-Time I/O Pattern Recognition to Enhance Performance and Endurance of a Storage Device,” (2) U.S. Provisional Patent Application Ser. No. 62/005,423, filed May 30, 2014, entitled “Identification of Hot Regions to Enhance Performance and Endurance of a Non-Volatile Storage Device,” (3) U.S. Provisional Patent Application Ser. No. 62/005,435, filed May 30, 2014, entitled “Using History of I/O Sizes and I/O Sequences to Trigger Coalesced Writes in a Non-Volatile Storage Device,” (4) U.S. Provisional Patent Application Ser. No. 62/005,452, filed May 30, 2014, entitled “Using History of I/O Sequences to Trigger Cached Read Ahead in a Non-Volatile Storage Device,” (5) U.S. Provisional Patent Application Ser. No. 62/005,966, filed May 30, 2014, entitled “Using History of Unaligned Writes to Cache Data and Avoid Read-Modify-Writes in a Non-Volatile Storage Device,” and (6) U.S. Provisional Patent Application Ser. No. 62/005,971, filed May 30, 2014, entitled “Using Sub-Region I/O History to Cache Repeatedly Accessed Sub-Regions in a Non-Volatile Storage Device,” which are hereby incorporated by reference in their entirety.

TECHNICAL FIELD

The disclosed embodiments relate generally to memory systems, and in particular, to prioritizing garbage collection and block allocation based on I/O history for logical address regions.

BACKGROUND

Semiconductor memory devices, including flash memory, typically utilize memory cells to store data as an electrical value, such as an electrical charge or voltage. A flash memory cell, for example, includes a single transistor with a floating gate that is used to store a charge representative of a data value. Flash memory is a non-volatile data storage device that can be electrically erased and reprogrammed. More generally, non-volatile memory (e.g., flash memory, as well as other types of non-volatile memory implemented using any of a variety of technologies) retains stored information even when not powered, as opposed to volatile memory, which requires power to maintain the stored information. Increases in storage density have been facilitated in various ways, including increasing the density of memory cells on a chip enabled by manufacturing developments, and transitioning from single-level flash memory cells to multi-level flash memory cells, so that two or more bits can be stored by each flash memory cell.

Since flash memory can only be programmed and erased a limited number of times, it is important to optimize memory management processes (e.g., garbage collection, wear leveling, caching, etc.) to enhance performance and endurance of memory devices.

SUMMARY

Various implementations of systems, methods and devices within the scope of the appended claims each have several aspects, no single one of which is solely responsible for the attributes described herein. Without limiting the scope of the appended claims, after considering this disclosure, and particularly after considering the section entitled “Detailed Description” one will understand how the aspects of various implementations are used to enable prioritizing garbage collection and block allocation based on I/O history for logical address regions. In one aspect, in accordance with identification of an idle region of a plurality of regions in a logical address space of a host, enabling garbage collection of data storage blocks, in a storage device, that store data in the idle region.

BRIEF DESCRIPTION OF THE DRAWINGS

So that the present disclosure can be understood in greater detail, a more particular description may be had by reference to the features of various implementations, some of which are illustrated in the appended drawings. The appended drawings, however, merely illustrate the more pertinent features of the present disclosure and are therefore not to be considered limiting, for the description may admit to other effective features.

FIG. 1 is a block diagram illustrating an implementation of a data storage system, in accordance with some embodiments.

FIG. 2A is a block diagram illustrating an implementation of a management module, in accordance with some embodiments.

FIG. 2B is a block diagram illustrating an implementation of a history table included in FIG. 2A, in accordance with some embodiments.

FIG. 3 is a block diagram of a plurality of regions in a logical address space of a host, in accordance with some embodiments.

FIG. 4 is a block diagram of a forward mapping table, physical address space, and bank data, in accordance with some embodiments.

FIG. 5 is a block diagram of a cache with a cached sub-region, in accordance with some embodiments.

FIGS. 6A-6C illustrate a flowchart representation of a memory management method, in accordance with some embodiments.

In accordance with common practice the various features illustrated in the drawings may not be drawn to scale. Accordingly, the dimensions of the various features may be arbitrarily expanded or reduced for clarity. In addition, some of the drawings may not depict all of the components of a given system, method or device. Finally, like reference numerals may be used to denote like features throughout the specification and figures.

DETAILED DESCRIPTION

The various implementations described herein include systems, methods and/or devices used to enable prioritizing garbage collection and block allocation based on I/O history for logical address regions. Some implementations include systems, methods and/or devices to enable, in accordance with identification of an idle region of a plurality of regions in a logical address space of a host, garbage collection of data storage blocks, in a storage device, that store data in the idle region.

More specifically, some embodiments include a method in which a plurality of input/output (I/O) requests are received at a storage device from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host. In these embodiments, the method further includes, in accordance with the plurality of I/O requests over a predetermined time period, identifying an idle region of the plurality of regions in the logical address space of the host, and in accordance with the identification of the idle region, enabling garbage collection of data storage blocks, in the storage device, that store data in the idle region.

In some embodiments, the method further includes identifying one or more data storage blocks, in the storage device, that store data in the idle region and that satisfy predefined garbage collection criteria, and initiating garbage collection of the identified one or more data storage blocks.

In some embodiments, identifying one or more data storage blocks comprises mapping one or more logical addresses corresponding to the idle region to physical addresses in a physical address space of the storage device.

In some embodiments, identifying the idle region comprises identifying a region that has not been accessed at least once by the plurality of I/O requests during the predetermined time period.

In some embodiments, the method further includes (1) determining whether a respective bank of a plurality of banks in the storage device is participating in garbage collection, and (2) in accordance with a determination that the respective bank is not participating in garbage collection, allocating blocks from the respective bank for subsequent write requests.

In some embodiments, each bank of the plurality of banks comprises a plurality of data storage blocks, and the respective bank is not participating in garbage collection of any of the identified one or more data storage blocks.

In some embodiments, the method further includes, for each region of the plurality of regions in the logical address space, setting a flag to denote a determination of whether the region is an idle region during the predetermined time period.

In some embodiments, the method further includes, for each region of the plurality of regions in the logical address space, storing information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period.

In some embodiments, the predetermined time period is configurable.

In some embodiments, the predetermined threshold number is configurable.

In some embodiments, the storage device comprises one or more flash memory devices.

In some embodiments, the storage device comprises one or more three-dimensional (3D) memory devices and circuitry associated with operation of memory elements in the one or more 3D memory devices.

In some embodiments, the circuitry and one or more memory elements in a respective 3D memory device, of the one or more 3D memory devices, are on the same substrate.

In another aspect, any of the methods described above are performed by a storage device, the storage device including (1) one or more processors, and (2) memory storing one or more programs, which when executed by the one or more processors cause the storage device to perform or control performance of any of the methods described herein.

In yet another aspect, any of the methods described above are performed by a storage device including means for performing any of the methods described herein.

In yet another aspect, any of the methods described above are performed by a storage system comprising (1) a storage medium (e.g., comprising one or more non-volatile storage devices, such as flash memory devices) (2) one or more processors, and (3) memory storing one or more programs, which when executed by the one or more processors cause the storage system to perform or control performance of any of the methods described herein.

In yet another aspect, some embodiments include a non-transitory computer readable storage medium, storing one or more programs configured for execution by one or more processors of a storage device, the one or more programs including instructions for performing any of the methods described herein.

Numerous details are described herein in order to provide a thorough understanding of the example implementations illustrated in the accompanying drawings. However, some embodiments may be practiced without many of the specific details, and the scope of the claims is only limited by those features and aspects specifically recited in the claims. Furthermore, well-known methods, components, and circuits have not been described in exhaustive detail so as not to unnecessarily obscure more pertinent aspects of the implementations described herein.

FIG. 1 is a block diagram illustrating an implementation of data storage system 100, in accordance with some embodiments. While some example features are illustrated, various other features have not been illustrated for the sake of brevity and so as not to obscure more pertinent aspects of the example implementations disclosed herein. To that end, as a non-limiting example, data storage system 100 includes a storage device 120, which includes a storage controller 124 and a storage medium 130, and is used in conjunction with a computer system 110. In some implementations, storage medium 130 is a single flash memory device while in other implementations storage medium 130 includes a plurality of flash memory devices. In some implementations, storage medium 130 is NAND-type flash memory or NOR-type flash memory. In some implementations, storage medium 130 includes one or more three-dimensional (3D) memory devices, as further defined herein. Further, in some implementations storage controller 124 is a solid-state drive (SSD) controller. However, other types of storage media may be included in accordance with aspects of a wide variety of implementations.

Computer system 110 is coupled to storage controller 124 through data connections 101. However, in some implementations computer system 110 includes storage controller 124 as a component and/or a sub-system. Computer system 110 may be any suitable computer device, such as a computer, a laptop computer, a tablet device, a netbook, an internet kiosk, a personal digital assistant, a mobile phone, a smart phone, a gaming device, a computer server, or any other computing device. Computer system 110 is sometimes called a host or host system. In some implementations, computer system 110 includes one or more processors, one or more types of memory, a display and/or other user interface components such as a keyboard, a touch screen display, a mouse, a track-pad, a digital camera and/or any number of supplemental devices to add functionality.

Storage medium 130 is coupled to storage controller 124 through connections 103. Connections 103 are sometimes called data connections, but typically convey commands in addition to data, and optionally convey metadata, error correction information and/or other information in addition to data values to be stored in storage medium 130 and data values read from storage medium 130. In some implementations, however, storage controller 124 and storage medium 130 are included in the same device as components thereof. Furthermore, in some implementations storage controller 124 and storage medium 130 are embedded in a host device, such as a mobile device, tablet, other computer or computer controlled device, and the methods described herein are performed by the embedded memory controller. Storage medium 130 may include any number (i.e., one or more) of memory devices including, without limitation, non-volatile semiconductor memory devices, such as flash memory. For example, flash memory devices can be configured for enterprise storage suitable for applications such as cloud computing, or for caching data stored (or to be stored) in secondary storage, such as hard disk drives. Additionally and/or alternatively, flash memory can also be configured for relatively smaller-scale applications such as personal flash drives or hard-disk replacements for personal, laptop and tablet computers. In some embodiments, storage medium 130 includes one or more three-dimensional (3D) memory devices, as further defined herein.

Storage medium 130 is divided into a number of addressable and individually selectable blocks, such as selectable portion 131. In some implementations, the individually selectable blocks are the minimum size erasable units in a flash memory device. In other words, each block contains the minimum number of memory cells that can be erased simultaneously. Each block is usually further divided into a plurality of pages and/or word lines, where each page or word line is typically an instance of the smallest individually accessible (readable) portion in a block. In some implementations (e.g., using some types of flash memory), the smallest individually accessible unit of a data set, however, is a sector, which is a subunit of a page. That is, a block includes a plurality of pages, each page contains a plurality of sectors, and each sector is the minimum unit of data for reading data from the flash memory device.

For example, one block comprises any number of pages, for example, 64 pages, 128 pages, 256 pages or another suitable number of pages. Blocks are typically grouped into a plurality of zones. Each block zone can be independently managed to some extent, which increases the degree of parallelism for parallel operations and simplifies management of storage medium 130.

In some implementations, storage controller 124 includes a management module 121, a host interface 129, a storage medium interface (I/O) 128, and additional module(s) 125. Storage controller 124 may include various additional features that have not been illustrated for the sake of brevity and so as not to obscure more pertinent features of the example implementations disclosed herein, and a different arrangement of features may be possible. Host interface 129 provides an interface to computer system 110 through data connections 101. Similarly, storage medium I/O 128 provides an interface to storage medium 130 though connections 103. In some implementations, storage medium I/O 128 includes read and write circuitry, including circuitry capable of providing reading signals to storage medium 130 (e.g., reading threshold voltages for NAND-type flash memory).

In some implementations, management module 121 includes one or more processing units (CPUs, also sometimes called processors) 122 configured to execute instructions in one or more programs (e.g., in management module 121). In some implementations, the one or more CPUs 122 are shared by one or more components within, and in some cases, beyond the function of storage controller 124. Management module 121 is coupled to host interface 129, additional module(s) 125 and storage medium I/O 128 in order to coordinate the operation of these components.

Additional module(s) 125 are coupled to storage medium I/O 128, host interface 129, and management module 121. As an example, additional module(s) 125 may include an error control module to limit the number of uncorrectable errors inadvertently introduced into data during writes to memory or reads from memory. In some embodiments, additional module(s) 125 are executed in software by the one or more CPUs 122 of management module 121, and, in other embodiments, additional module(s) 125 are implemented in whole or in part using special purpose circuitry (e.g., to perform encoding and decoding functions).

During a write operation, host interface 129 receives data to be stored in storage medium 130 from computer system 110. The data held in host interface 129 is made available to an encoder (e.g., in additional module(s) 125), which encodes the data to produce one or more codewords. The one or more codewords are made available to storage medium I/O 128, which transfers the one or more codewords to storage medium 130 in a manner dependent on the type of storage medium being utilized.

A read operation is initiated when computer system (host) 110 sends one or more host read commands on control line 111 to storage controller 124 requesting data from storage medium 130. Storage controller 124 sends one or more read access commands to storage medium 130, via storage medium I/O 128, to obtain raw read data in accordance with memory locations (addresses) specified by the one or more host read commands. Storage medium I/O 128 provides the raw read data (e.g., comprising one or more codewords) to a decoder (e.g., in additional module(s) 125). If the decoding is successful, the decoded data is provided to host interface 129, where the decoded data is made available to computer system 110. In some implementations, if the decoding is not successful, storage controller 124 may resort to a number of remedial actions or provide an indication of an irresolvable error condition.

Flash memory devices utilize memory cells to store data as electrical values, such as electrical charges or voltages. Each flash memory cell typically includes a single transistor with a floating gate that is used to store a charge, which modifies the threshold voltage of the transistor (i.e., the voltage needed to turn the transistor on). The magnitude of the charge, and the corresponding threshold voltage the charge creates, is used to represent one or more data values. In some implementations, during a read operation, a reading threshold voltage is applied to the control gate of the transistor and the resulting sensed current or voltage is mapped to a data value.

The terms “cell voltage” and “memory cell voltage,” in the context of flash memory cells, means the threshold voltage of the memory cell, which is the minimum voltage that needs to be applied to the gate of the memory cell's transistor in order for the transistor to conduct current. Similarly, reading threshold voltages (sometimes also called reading signals, reading voltages, and/or read thresholds) applied to a flash memory cells are gate voltages applied to the gates of the flash memory cells to determine whether the memory cells conduct current at that gate voltage. In some implementations, when a flash memory cell's transistor conducts current at a given reading threshold voltage, indicating that the cell voltage is less than the reading threshold voltage, the raw data value for that read operation is a “1,” and otherwise the raw data value is a “0.”

As explained above, a storage medium (e.g., storage medium 130) is divided into a number of addressable and individually selectable blocks and each block is optionally (but typically) further divided into a plurality of pages and/or word lines and/or sectors. While erasure of a storage medium is performed on a block basis, in many embodiments, reading and programming of the storage medium is performed on a smaller subunit of a block (e.g., on a page basis, word line basis, or sector basis). In some embodiments, the smaller subunit of a block consists of multiple memory cells (e.g., single-level cells or multi-level cells). In some embodiments, programming is performed on an entire page. In some embodiments, a multi-level cell (MLC) NAND flash typically has four possible states per cell, yielding two bits of information per cell. Further, in some embodiments, a MLC NAND has two page types: (1) a lower page (sometimes called fast page), and (2) an upper page (sometimes called slow page).

As an example, if data is written to a storage medium in pages, but the storage medium is erased in blocks, pages in the storage medium may contain invalid (e.g., stale) data, but those pages cannot be overwritten until the whole block containing those pages is erased. In order to write to the pages with invalid data, the pages with valid data in that block are read and re-written to a new block and the old block is erased (or put on a queue for erasing). This process is called garbage collection. After garbage collection, the new block contains pages with valid data and free pages that are available for new data to be written, and the old block that was erased is also available for new data to be written. Since flash memory can only be programmed and erased a limited number of times, the efficiency of the algorithm used to pick the next block(s) to re-write and erase has a significant impact on the lifetime and reliability of flash-based storage systems.

Write amplification is a phenomenon where the actual amount of physical data written to a storage medium (e.g., storage medium 130) is a multiple of the logical amount of data intended to be written by a host (e.g., computer system 110, sometimes called a host). As discussed above, when a storage medium must be erased before it can be re-written, the garbage collection process to perform these operations results in re-writing data one or more times. This multiplying effect increases the number of writes required over the life of a storage medium, which shortens the time it can reliably operate. The formula to calculate the write amplification of a storage system is given by equation (1):

$\begin{matrix} \frac{{amount}\mspace{14mu}{of}\mspace{14mu}{data}\mspace{14mu}{written}\mspace{14mu}{to}\mspace{14mu} a\mspace{14mu}{storage}\mspace{14mu}{medium}}{{amount}\mspace{14mu}{of}\mspace{14mu}{data}\mspace{14mu}{written}\mspace{14mu}{by}\mspace{14mu} a\mspace{14mu}{host}} & (1) \end{matrix}$

One of the goals of any storage system architecture is to reduce write amplification as much as possible so that available endurance is used to meet storage medium reliability and warranty specifications. Higher system endurance also results in lower cost as the storage system may need less over-provisioning. By reducing the write amplification, the endurance of the storage medium is increased and the overall cost of the storage system is decreased. Generally, garbage collection is performed on erase blocks with the fewest number of valid pages for best performance and best write amplification.

FIG. 2A is a block diagram illustrating an exemplary management module 121, in accordance with some embodiments. Management module 121 typically includes one or more processing units (CPUs) 122 for executing modules, programs and/or instructions stored in memory 206 and thereby performing processing operations, memory 206, and one or more communication buses 208 for interconnecting these components. Communication buses 208 optionally include circuitry (sometimes called a chipset) that interconnects and controls communications between system components. Management module 121 is coupled to host interface 129, additional module(s) 125, and storage medium I/O 128 by communication buses 208. Memory 206 includes high-speed random access memory, such as DRAM, SRAM, DDR RAM or other random access solid state memory devices, and may include non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Memory 206 optionally includes one or more storage devices remotely located from the CPU(s) 122. Memory 206, or alternately the non-volatile memory device(s) within memory 206, comprises a non-transitory computer readable storage medium. In some embodiments, memory 206, or the computer readable storage medium of memory 206 stores the following programs, modules, and data structures, or a subset thereof:

-   -   I/O receiving module 210 that is used for receiving from a host         a plurality of input/output (I/O) requests (e.g., read requests         and/or write requests to be performed in a plurality of regions         in a logical address space of the host);     -   translation table 212 that is used for mapping logical addresses         to physical addresses (e.g., in some embodiments, translation         table 212 includes forward mapping table 402, FIG. 4);     -   data read module 214 that is used for reading data from one or         more blocks in a storage medium;     -   data write module 216 that is used for writing data to one or         more blocks in a storage medium;     -   data erase module 218 that is used for erasing data from one or         more blocks in a storage medium;     -   garbage collection module 220 that is used for garbage         collection for one or more blocks in a storage medium;     -   history maintaining module 222 that is used for maintaining a         history of I/O request patterns (e.g., one or more histories of         I/O request patterns) in one or more regions of a plurality of         regions in a logical address space of a host;     -   history table 224 that includes a collection of data structures         (e.g., region data structures 244, FIG. 2B), each data structure         storing data for a respective region of a plurality of regions         in a logical address space of a host;     -   adjustment module 226 that is used for using the history of I/O         request patterns in a respective region to adjust subsequent I/O         processing in the respective region;     -   cache module 228 that is used for caching data from one or more         regions (or one or more sub-regions within the one or more         regions) of a plurality of regions in a logical address space of         a host (e.g., from a storage medium of a storage device to a         cache of the storage device);     -   region module 230 that is used for performing one or more         operations for each region of the plurality of regions in the         logical address space of the host, optionally including:         -   identification module 232 that is used for identifying an             idle region of the plurality of regions in the logical             address space of the host; and         -   enable module 234 that is used for enabling garbage             collection of data storage blocks; and     -   determination module 236 that is used for determining whether a         respective bank of a plurality of banks in the storage device is         participating in garbage collection.

Each of the above identified elements may be stored in one or more of the previously mentioned memory devices, and corresponds to a set of instructions for performing a function described above. The above identified modules or programs (i.e., sets of instructions) need not be implemented as separate software programs, procedures or modules, and thus various subsets of these modules may be combined or otherwise re-arranged in various embodiments. In some embodiments, memory 206 may store a subset of the modules and data structures identified above. Furthermore, memory 206 may store additional modules and data structures not described above. In some embodiments, the programs, modules, and data structures stored in memory 206, or the computer readable storage medium of memory 206, provide instructions for implementing any of the methods described below with reference to FIGS. 6A-6C.

Although FIG. 2A shows management module 121 in accordance with some embodiments, FIG. 2A is intended more as a functional description of the various features which may be present in management module 121 than as a structural schematic of the embodiments described herein. In practice, and as recognized by those of ordinary skill in the art, items shown separately could be combined and some items could be separated.

FIG. 2B is a block diagram illustrating an implementation of a history table 224 included in FIG. 2A, in accordance with some embodiments. History table 224 includes a collection of region data structures 244, that each store data associated with a respective region of a plurality of regions in a logical address space of a host (e.g., a respective region 310-i of a plurality of regions in a logical address space, FIG. 3). An example of a logical address space of a host is described in further detail below with respect to FIG. 3. In some embodiments, the data stored in region data structures 244 includes information regarding real-time history of I/O request patterns per region, for each region of a plurality of regions in a logical address space. For example, without limitation, in some embodiments in which a logical address space of a host (e.g., computer system 110, FIG. 1) includes a plurality of regions (e.g., region 310-1 through region 310-m, FIG. 3), history table 224 includes at least one region data structure for each region (e.g., region data structure 244-1 for region 310-1, region data structure 244-2 for region 310-2, etc.). In some embodiments, a history of I/O request patterns is maintained for only the regions that have some I/O activity during a predetermined time period. In some embodiments, a history of I/O request patterns is maintained for a subset of all the regions in a logical address space of a host. In some embodiments, a history of I/O request patterns is maintained for all of the regions in a logical address space of a host. In some embodiments, history table 224 is maintained in one or more data structures stored on a storage device (e.g., storage device 120, FIG. 1). In some embodiments, the storage device gathers data as I/O requests are processed and stores the history of I/O request patterns and/or determinations based on the history of I/O request patterns in history table 224. In some embodiments, history table 224 is maintained in one or more data structures stored on a host (e.g., computer system 110, FIG. 1). In some embodiments, the host gathers data as I/O requests are processed and stores the history of I/O request patterns and/or determinations based on the history of I/O request patterns in history table 224. In some embodiments, one or more operations performed to gather data and/or make determinations based on the data are performed at a host (e.g., computer system 110, FIG. 1), and relevant information is transmitted to a storage device (e.g., storage device 120, FIG. 1).

In some embodiments, each region data structure (e.g., region data structure 244-i) includes information regarding real-time history of I/O request patterns for a respective region, sometimes herein called a logical address region. For example, in some embodiments, region data structure 244-1 includes information regarding real-time history of I/O request patterns for region 1 of a plurality of regions, region data structure 244-2 includes information regarding real-time history of I/O request patterns for Region 2 of the plurality of regions, and so on. In some embodiments, the history of I/O request patterns is maintained for each region for a predetermined time period (e.g., one hour). In some embodiments, the predetermined time period is configurable. In some embodiments, after the predetermined time period, the history of I/O request patterns is reset (e.g., cleared). In some embodiments, one or more parameters of region data structure 244-i are not reset until a later time. In some embodiments, some parameters of a data structure (e.g., region data structure 244-i) are reset (e.g., cleared) after the predetermined time period, while other parameters of the data structure are not reset until a later time. For example, in some embodiments, parameters tracking various count values (e.g., sequential read count 250, sequential write count 252, small write count 254, unaligned write count 256 and/or large write count 258) are reset after the predetermined time period, but if the respective region still meets certain criteria (e.g., if the respective region is still a hot region), other parameters of the data structure are not reset until a later time (e.g., hot region flag 264, FIG. 2B, is not reset until the region is no longer hot).

Region data structure 244-i illustrates an implementation of a region data structure for a respective region (e.g., region i), in accordance with some embodiments. In some embodiments, region data structure 244-i stores the following data (sometimes called history of I/O requests for a particular time period, for a particular region of the logical address space), or a subset or superset thereof:

-   -   lowest LBA accessed 246 that is used for tracking a lowest         logical block address (LBA) accessed in the region;     -   highest LBA accessed 248 that is used for tracking a highest         logical block address (LBA) accessed in the region;     -   sequential read count 250 that is used for tracking a total         number of sequential read requests from the region;     -   sequential write count 252 that is used for tracking a total         number of sequential write requests to the region;     -   small write count 254 that is used for tracking a total number         of write requests to write data of size less than a predefined         small-size threshold;     -   unaligned write count 256 that is used for tracking a total         number of unaligned write requests to the region, wherein         unaligned write requests are write requests not aligned with         predefined page boundaries;     -   large write count 258 that is used for tracking a total number         of write requests to write data of size greater than a         predefined large-size threshold;     -   flags 260 that are used for tracking one or more determinations         based on the history of I/O request patterns, including in some         embodiments, one or more of:         -   sequential region flag 262 that is used for tracking whether             a total number of sequential I/O requests to the region has             exceeded a sequential request threshold;         -   hot region flag 264 that is used for tracking whether a             total number of write requests to the region has exceeded a             write threshold;         -   valid region flag 266 that is used for tracking whether the             region is accessed at least once by a plurality of I/O             requests;         -   optionally, one or more additional flags, each for tracking             a corresponding determination based on the history of I/O             request patterns;     -   time stamp 268 that is used for recording a time stamp         corresponding to when the history of I/O request patterns is         reset; and     -   sub-region counters 270 that are used for tracking a total         number of times each sub-region (of a plurality of sub-regions         in the region) is accessed.

FIG. 3 is a block diagram of a plurality of regions in a logical address space of a host, in accordance with some embodiments. In some embodiments, a logical address is the address at which an item (e.g., data stored on a memory cell) resides from the perspective of a host (e.g., computer system 110, FIG. 1). In some embodiments, a logical address differs from a physical address due to the operation of a mapping function or address translator (e.g., translation table 212, FIG. 2A, including forward mapping table 402, FIG. 4). In some embodiments, a logical block address (LBA) is mapped to a physical flash address (e.g., a physical page number (PPN), including a bank, block, and page), as described further with respect to FIG. 4.

In some embodiments, a logical address space includes a plurality of regions (e.g., region 310-1 through region 310-m), and each region includes a plurality of sub-regions (e.g., sub-region 312-1 through sub-region 312-n). In some embodiments, for example, if a storage device with an advertised capacity of 1 terabyte (TB) is divided into m regions, each region will be (1 TB)/m in size (e.g., if m=1024, each region will be (1 TB)/1024=1 gigabyte (GB) in size), and if each region is divided into n sub-regions, each sub-region will be ((1 TB)/m)/n in size (e.g., if m=1024 and n=1024, each sub-region will be ((1 TB)/1024)/1024=1 megabyte (MB) in size).

As described above with respect to FIG. 2B, in some embodiments, real-time history of I/O request patterns for a respective region is maintained for a plurality of regions in the logical address space. In some embodiments, the real-time history of I/O request patterns for a respective region (e.g., region i) is maintained in a region data structure (e.g., region data structure 244-i, FIG. 2B), which stores data corresponding to the history of I/O request patterns for the region and/or data corresponding to determinations made in accordance with the history of I/O request patterns for the region. For example, in some embodiments, real-time history of I/O request patterns for region 310-1 is maintained (e.g., in region data structure 244-1, FIG. 2B), and if a total number of write requests to region 310-1 has exceeded a write threshold during a predetermined time period, region 310-1 is marked with a hot region indicator (e.g., using hot region flag 264, FIG. 2B).

FIG. 4 is a block diagram of a forward mapping table 402, physical address space 410, and bank data 430, in accordance with some embodiments. In some embodiments, forward mapping table 402 is used to translate a logical block address (LBA) from the perspective of a host (e.g., computer system 110, FIG. 1) to a physical address in a physical address space (e.g., physical address space 410) of a storage device (e.g., storage device 120, FIG. 1). In some embodiments, an LBA is the smallest unit that is accessible by a host (e.g., 512 B). In some embodiments, LBAs are organized in numerical order in the logical address space. Using the example from FIG. 3, in some embodiments, where the logical address space includes a plurality of regions and each region is 1 GB in size, the LBAs in the first 1 GB of the logical address space are in a first region (e.g., region 310-1, FIG. 3), the LBAs in the second 1 GB of the logical address space are in a second region (e.g., region 310-2, FIG. 3), and so on.

In some embodiments, forward mapping table 402 is stored in memory associated with the storage device (e.g., in memory 206, as part of translation table 212, FIG. 2A). In some embodiments, a physical address is a physical page number (PPN), including a bank number, a block number, and a page number. In the example shown in FIG. 4, LBA 0 is mapped to bank 1 (e.g., Bank 420-1), block 3 (e.g., Block 421-3), page 37 (pages not shown in FIG. 4) of physical address space 410.

In some embodiments, bank data 430 includes information for each bank of physical address space 410 (e.g., bank 420-1 through 420-q). For example, in some embodiments, for bank i (e.g., bank 420-i), bank data 430 includes a queue of available blocks in bank i (e.g., for which to write data), a pointer to an active block in bank i (e.g., a block to which data from write requests is written), and a pointer to an active hot block in bank i (e.g., a block to which data from write requests to hot regions is written). For example, if a region (e.g., region 310-1, FIG. 3) is marked with a hot region indicator (e.g., using hot region flag 264, FIG. 2B), in some embodiments, subsequent write requests to that region are written to an active hot block. Conversely, if a region (e.g., region 310-1, FIG. 3) is not marked with a hot region indicator, in some embodiments, subsequent write requests to that region are written to an active block (sometimes referred to as an active “cold block,” as opposed to an active hot block). Depending on how LBAs are mapped to banks in forward mapping table 402, each bank in physical address space 410 may need to store data specified by a write request to a region marked with a hot region indicator (sometimes referred to as a “hot region”) and/or store data specified by a write request to a region not marked with a hot region indicator (sometimes referred to as a “cold region”). In some embodiments, if an LBA for a write request is from a hot region, the data specified by the write request is stored on the active hot block, and if the LBA for a write request is from a cold region, the data specified by the write request is stored on the active block (e.g., a cold block that is active). In this manner, data associated with hot regions are grouped together (e.g., on hot blocks) and data associated with cold regions are grouped together (e.g., on cold blocks).

Typically, data in hot regions are invalidated faster than data in cold regions, due to a higher frequency of updates to data in the hot regions than updates to data in the cold regions. For example, if certain popular files are accessed and edited frequently (e.g., if a user frequently accesses and edits certain documents), in some embodiments, the region of the logical address space in which those popular files reside are marked with a hot region indicator, if the region is accessed more than a predetermined threshold during a predefined period of time. In some embodiments, the LBAs of the hot region are mapped to blocks (and pages) in the physical address space (e.g., physical address space 410) of the storage device (e.g., storage device 120, FIG. 1) using a translation table (e.g., forward mapping table 402), and the open blocks associated with the hot region are marked with a hot block indicator. In some embodiments, for each bank of physical address space 410, bank data 430 includes a queue of hot blocks available for writing, with a pointer to the active hot block for storing data from write requests to a hot region. In some embodiments, for each bank of physical address space 410, bank data 430 includes a queue of cold blocks available for writing, with a pointer to the active cold block for storing data from write requests to a cold region. Since hot regions, by definition, are written to more frequently than cold regions, pages in the hot blocks are typically invalidated faster (i.e., more frequently, on average) than pages in the cold blocks. By grouping together data associated with hot regions in the hot blocks, hot blocks will typically have more invalid pages due to the frequent updating of data in the hot regions, resulting in fewer valid pages that need to be copied in a garbage collection operation. By grouping together data from cold regions in the cold blocks, cold blocks will typically have more valid pages, due to the lower frequency of updates in the cold regions than the hot regions, and will be less likely to be selected for garbage collection, reducing the movement of cold data to new blocks. This localization of writes from hot regions to hot blocks and localization of writes from cold regions to cold blocks reduces the number of blocks that require garbage collection and reduces the number of valid pages that need to be copied during garbage collection, thus reducing write amplification and improving endurance of the storage device.

Although the description herein uses examples in which regions are separated into two categories (e.g., hot or cold) and blocks are separated into two categories accordingly, those skilled in the art will appreciate that the embodiments described herein may be extended to more than two categories (e.g., three categories for regions and associated blocks, including hot, warm, and cold).

In some embodiments, the storage device maintains both forward mapping table 402, and one or more reverse mapping tables (not shown) that map physical addresses in the physical address space to logical addresses in the logical address space of the host.

FIG. 5 is a block diagram of a cache 500 with a cached sub-region 510, in accordance with some embodiments. In some embodiments, cache 500 is included in a storage device (e.g., storage device 120, FIG. 1). In some embodiments, cache 500 is implemented in one or more volatile random access memory devices, such as, without limitation, DRAM or SRAM devices. In some embodiments, cache 500 is physically external to a storage device (e.g., external to storage device 120, FIG. 1). For example, in some embodiments, cache 500 is located in a DRAM device external to the storage device, where the DRAM device may be sized differently for different customers. In some other embodiments, cache 500 is physically part of the storage device.

In some embodiments, sub-regions that meet predefined criteria (e.g., sub-regions that are accessed more than a predetermined threshold number of times and/or sub-regions that have a history of unaligned write requests) are cached to cache 500. For example, in some embodiments, if a region (e.g., region 310-2, FIG. 3) has a history of unaligned write requests (e.g., determined from unaligned write count 256, FIG. 2B), where unaligned write requests are write requests not aligned with predefined page boundaries, a sub-region in that region (e.g., sub-region 312-3, FIG. 3) that is accessed more than a predetermined threshold number of times is cached to cache 500. In some embodiments, the predefined page boundaries are defined with respect to the logical address space of the host. In one example, in which L logical blocks (e.g., 8 blocks) are mapped to each physical page in storage medium 130, the predefined page boundaries are the logical addresses of the first (or last) location in each set of L logical blocks. Restated, in this example, the predefined page boundaries are logical addresses in the logical address space that are positive integer multiples of L*B, where B is the size of one logical block and L is the number of logical blocks mapped to each physical page in storage medium 130. In a more specific example, the predefined page boundaries are logical addresses that are positive integer multiples of 4 KB (i.e., 4098 bytes).

I/O alignment refers to whether the starting address of an I/O request is a multiple of the smallest unit size of a storage medium (e.g., aligned with a 4 KB page of a NAND flash memory device). For every misaligned write, the storage device must perform at least one read-modify-write operation on data stored in non-volatile memory. For example, an unaligned write request spanning pages 0 through 2 (depicted by the dotted box in cached sub-region 510) normally requires two read-modify-write operations on data stored in non-volatile memory, since the unaligned write request is only modifying a portion of page 0 and a portion of page 2. In some embodiments, since a program (e.g., write) operation is performed on an entire (erased) page, the storage device first reads page 0 to determine the portion of data that is not modified, modifies the portion of data that is affected by the unaligned write request, writes the data to a new page location, and invalidates page 0. A similar process is needed for page 2. However, in some embodiments, if sub-region 510 is cached, unaligned writes are processed in the cache, and may then be written to a storage medium (e.g., storage medium 130, FIG. 1) in a merged operation, thus reducing or avoiding read-modify-write operations on data stored in non-volatile memory.

FIGS. 6A-6C illustrate a flowchart representation of a memory management method 600, in accordance with some embodiments. At least in some embodiments, method 600 is performed by a storage device (e.g., storage device 120, FIG. 1) or one or more components of the storage device (e.g., storage controller 124 and/or storage medium 130, FIG. 1), wherein the storage device is operatively coupled with a host system (e.g., computer system 110, FIG. 1). In some embodiments, method 600 is governed by instructions that are stored in a non-transitory computer readable storage medium and that are executed by one or more processors of a device, such as the one or more processing units (CPUs) 122 of management module 121, shown in FIGS. 1 and 2A. In some embodiments, method 600 is performed by a storage system (e.g., data storage system 100, FIG. 1) or one or more components of the storage system (e.g., computer system 110 and/or storage device 120, FIG. 1). In some embodiments, some of the operations of method 600 are performed at a host (e.g., computer system 110, FIG. 1) and information is transmitted to a storage device (e.g., storage device 120, FIG. 1). In some embodiments, method 600 is governed, at least in part, by instructions that are stored in a non-transitory computer readable storage medium and that are executed by one or more processors of a host (not shown in FIG. 1). For ease of explanation, the following describes method 600 as performed by a storage device (e.g., storage device 120, FIG. 1). However, those skilled in the art will appreciate that in other embodiments, one or more of the operations described in method 600 are performed by a host (e.g., computer system 110, FIG. 1).

A storage device (e.g., storage device 120, FIG. 1) receives (602) a plurality of input/output (I/O) requests from a host (e.g., computer system 110, FIG. 1), the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host. In some embodiments, the I/O requests specify operations (sometimes called storage operations or memory operations) to be performed with respect to logical addresses in a plurality of regions in a logical address space of a host (e.g., regions 310, FIG. 3). In some embodiments, the plurality of I/O requests includes read requests from one or more regions of the plurality of regions and write requests to one or more regions of the plurality of regions. For example, in some embodiments, the plurality of I/O requests includes one or more read requests from one or more regions of the plurality of regions (e.g., regions 310, FIG. 3) and one or more write requests to one or more regions of the plurality of regions. In some embodiments, an I/O receiving module (e.g., I/O receiving module 210, FIG. 2A) is used to receive a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of regions in a logical address space of the host, as described above with respect to FIG. 2A.

In some embodiments, the storage device comprises (604) one or more flash memory devices. In some embodiments, the storage device comprises a storage medium (e.g., storage medium 130, FIG. 1), and the storage medium comprises one or more non-volatile storage devices, such as flash memory devices. In some embodiments, the storage medium (e.g., storage medium 130, FIG. 1) is a single flash memory device, while in other embodiments the storage medium includes a plurality of flash memory devices. For example, in some implementations, the storage medium includes dozens or hundreds of flash memory devices, organized in parallel memory channels, such as 16, 32 or 64 flash memory devices per memory channel, and 8, 16 or 32 parallel memory channels. In some embodiments, the non-volatile storage medium (e.g., storage medium 130, FIG. 1) includes NAND-type flash memory or NOR-type flash memory. In other embodiments, the storage medium comprises one or more other types of non-volatile storage devices.

In some embodiments, the storage device comprises (606) one or more three-dimensional (3D) memory devices, as further defined herein, and circuitry associated with operation of memory elements in the one or more 3D memory devices. In some embodiments, the storage device comprises a storage medium (e.g., storage medium 130, FIG. 1), and the storage medium comprises one or more 3D memory devices and circuitry associated with operation of memory elements in the one or more 3D memory devices. In some embodiments, the storage medium (e.g., storage medium 130, FIG. 1) is a single 3D memory device, while in other embodiments the storage medium includes a plurality of 3D memory devices.

In some embodiments, the circuitry and one or more memory elements in a respective 3D memory device, of the one or more 3D memory devices, are (608) on the same substrate (e.g., a silicon substrate). In some embodiments, the substrate is a wafer on which the material layers of the one or more memory elements are deposited and/or in which the one or more memory elements are formed. In some embodiments, the substrate is a carrier substrate which is attached to the one or more memory elements after they are formed. As a non-limiting example, in some embodiments, the substrate includes a semiconductor such as silicon.

The storage device, in accordance with the plurality of I/O requests over a predetermined time period, identifies (610) an idle region of the plurality of regions in the logical address space of the host. In some embodiments, the plurality of regions is a subset of all the regions in the logical address space. For example, in some embodiments, the storage device identifies an idle region of a subset of all the regions in the logical address space. In some embodiments, the plurality of regions is all of the regions in the logical address space. For example, in some embodiments, the storage device identifies an idle region of all of the regions in the logical address space. In some embodiments, an identification module (e.g., identification module 232, FIG. 2A) is used to identify, in accordance with the plurality of I/O requests over a predetermined time period, an idle region of the plurality of regions in the logical address space of the host, as described above with respect to FIG. 2A.

In some embodiments, identifying the idle region comprises identifying (614) a region that has not been accessed at least once by the plurality of I/O requests during the predetermined time period. In some embodiments, identifying a region that has not been accessed at least once by the plurality of I/O requests during the predetermined time period includes tracking, for each region of the plurality of regions in the logical address space of the host, whether the region is accessed at least once by the plurality of I/O requests during the predetermined time period. In some embodiments, identifying a region that has not been accessed at least once by the plurality of I/O requests during the predetermined time period is based on information (e.g., data gathered regarding I/O requests for the region) stored in a data structure (e.g., region data structure 244-i, FIG. 2B) for maintaining a history of I/O request patterns in a respective region for the predetermined time period. In some embodiments, a determination of whether a respective region is accessed at least once by the plurality of I/O requests is tracked and/or recorded using a parameter stored in a data structure (e.g., using valid region flag 266 in region data structure 244-i, FIG. 2B). For example, in some embodiments, if region 310-1 (FIG. 3) is accessed at least once by the plurality of I/O requests during the aforementioned time period, valid region flag 266 of region data structure 244-1 (FIG. 2B) is set to true (e.g., a value of “1”).

In some embodiments, the predetermined time period is (616) configurable. For example, in some embodiments, the predetermined time period is configurable during initialization of the storage device (e.g., storage device 120, FIG. 1). As another example, in some embodiments, the predetermined time period is configurable during each power cycle of the storage device. In some embodiments, the predetermined time period is configurable using a configuration parameter, for example a configuration parameter specified by a command sent by a host system (e.g., computer system 110, FIG. 1). In some embodiments, the predetermined time period is configured to be a fixed number. In some embodiments, the predetermined time period is configured based on how long the history of I/O request patterns is to be maintained before resetting (e.g., clearing) the history (e.g., in region data structure 244-i, FIG. 2B). In some embodiments, some parameters of a data structure (e.g., region data structure 244-i, FIG. 2B) are reset (e.g., cleared) after the predetermined time period, while other parameters of the data structure are not reset until a later time. For example, in some embodiments, flags 260 are re-evaluated and set accordingly at the end of each predetermined time period based on the count values at the end of the predetermined time period, and parameters tracking various count values (e.g., sequential read count 250, sequential write count 252, small write count 254, unaligned write count 256 and/or large write count 258, FIG. 2B) are reset after the predetermined time period. Thus, if (i.e., in accordance with a determination that) the respective region still meets certain criteria (e.g., if the respective region is still a hot region), one or more other parameters (e.g., one or more respective flags 260) of the data structure are not reset until a later time (e.g., hot region flag 264, FIG. 2B, is not reset until the region is no longer hot). As a result, the respective time period used to determine whether to adjust a particular type of I/O operation may encompass both the prior predetermined time period (e.g., a one hour time period preceding the current one hour time period) and the current predetermined time period.

The storage device enables (612), in accordance with the identification of the idle region, garbage collection of data storage blocks, in the storage device, that store data in the idle region. For example, in some implementations, if region 310-1 (FIG. 3) is identified as an idle region (e.g., valid region flag 266 of region data structure 244-1, corresponding to region 310-1, is false), the storage device enables garbage collection of data storage blocks that store data in region 310-1. In some embodiments, each data storage block (e.g., block 421-3, FIG. 4) corresponds to a predefined range of physical addresses in a physical address space (e.g., physical address space 410, FIG. 4) of the storage device. In some embodiments, an enable module (e.g., enable module 234, FIG. 2A) is used to enable, in accordance with the identification of the idle region, garbage collection of data storage blocks, in the storage device, that store data in the idle region, as described above with respect to FIG. 2A.

Optionally, in some embodiments, the storage device identifies (618) one or more data storage blocks, in the storage device, that store data in the idle region and that satisfy predefined garbage collection criteria, and initiates garbage collection of the identified one or more data storage blocks. For example, in some embodiments, if region 310-1 (FIG. 3) is identified as an idle region (e.g., valid region flag 266 of region data structure 244-1, corresponding to region 310-1, is false), the storage device identifies one or more data storage blocks (e.g., one or more of blocks 421-424, FIG. 4) that store data in region 310-1 and that satisfy predefined garbage collection criteria (e.g., that have a minimum number or a minimum percentage of invalid pages), and initiates garbage collection of the identified one or more data storage blocks. In some embodiments, a region module (e.g., region module 230, FIG. 2A) and/or a garbage collection module (e.g., garbage collection module 220, FIG. 2A) are used to identify one or more data storage blocks, in the storage device, that store data in the idle region and that satisfy predefined garbage collection criteria, and initiate garbage collection of the identified one or more data storage blocks, as described above with respect to FIG. 2A.

In some embodiments, identifying one or more data storage blocks comprises mapping (620) one or more logical addresses corresponding to the idle region to physical addresses in a physical address space of the storage device. Using the example in FIG. 4, if LBA 0 through LBA 2 correspond to idle region 310-1 (FIG. 3), identifying one or more data storage blocks includes mapping LBA 0 through LBA 2 to physical addresses in a physical address space (e.g., physical address space 410, FIG. 4) of the storage device. Continuing with the example in FIG. 4, the storage device maps (e.g., using forward mapping table 402, FIG. 4) LBA 0 to block 3 from bank 1, maps LBA 1 to block 2043 from bank 5, and maps LBA 2 to block 6 from bank 2, thus identifying block 3 (from bank 1), block 2043 (from bank 5), and block 6 (from bank 2) as data storage blocks that store data in idle region 310-1.

In some other embodiments, the storage device uses one or more reverse translation tables (which map physical addresses to logical addresses) to identify one or more data storage blocks and to initiate garbage collection of the identified data storage blocks. In particular, in these embodiments, the storage device maintains a queue of blocks ready for garbage collection (i.e., that meet predefined garbage collection criteria), and the storage device (e.g., the garbage collection module 220, or enable module 234, or determination module 236) scans the blocks in the garbage collection queue to identify which of the blocks in the queue, if any, have physical addresses corresponding to logical addresses in idle regions of the host's logical address space. To do this, storage device maps the physical address of each block in the garbage collection queue to the corresponding logical address, using one or more physical address to logical address maps (also called reverse translation tables), and determines if that logical address falls within any of the regions identified as idle regions. Garbage collection is then enabled and/or initiated for the blocks identified by this process.

Optionally, in some embodiments, the storage device (1) determines (622) whether a respective bank of a plurality of banks in the storage device is participating in garbage collection, and (2) allocates, in accordance with a determination that the respective bank is not participating in garbage collection, blocks from the respective bank for subsequent write requests. For example, in some embodiments, the storage device determines whether bank 420-3 (FIG. 4) is participating in garbage collection and in accordance with a determination that bank 420-3 is not participating in garbage collection, allocates blocks from bank 420-3 for subsequent write requests (e.g., using the pointer to an active block for bank 420-3 or the pointer to an active hot block for bank 420-3 from bank data 430, FIG. 4). By scheduling writes and garbage collection on different banks, garbage collection latency in the write path is reduced. In some embodiments, a determination module (e.g., determination module 236, FIG. 2A) and/or a data write module (e.g., data write module 216, FIG. 2A) are used to determine whether a respective bank of a plurality of banks in the storage device is participating in garbage collection, and in accordance with a determination that the respective bank is not participating in garbage collection, allocate blocks from the respective bank for subsequent write requests, as described above with respect to FIG. 2A.

In some embodiments, each bank of the plurality of banks comprises (624) a plurality of data storage blocks, and the respective bank (from operation 622) is not participating in garbage collection of any of the identified one or more data storage blocks (from operation 618). For example, in some embodiments, each bank (e.g., bank 420-1, bank 420-2, bank 420-3, . . . , bank 420-q, FIG. 4) of the plurality of banks (e.g., banks 420, FIG. 4) comprises a plurality of data storage blocks (e.g., bank 420-3 comprises blocks 423-1, block 423-2, . . . , block 423-p), and if operation 622 determines that bank 420-3 (FIG. 4) is not participating in garbage collection and allocates block 423-2 from bank 420-3 for subsequent write requests, block 423-2 is not participating in garbage collection as initiated by operation 618.

In some embodiments, for each region of the plurality of regions in the logical address space of the host, the storage device sets (626) a flag to denote a determination of whether the region is an idle region during the predetermined time period. In some embodiments, setting a flag to denote a determination of whether the region is an idle region during the predetermined time period includes storing a flag (e.g., valid region flag 266, FIG. 2B) or other marker for the region. In some embodiments, a respective region is either valid (e.g., the region has been accessed at least once by a host) or idle (e.g., the region has not been accessed at least once by the host), but not both at the same time. In some embodiments, setting a flag to denote a determination of whether the region is an idle region during the predetermined time period includes setting the flag to “true” or “1” (as opposed to “false” or “0”) in accordance with a determination that the region has been accessed at least once by the plurality of I/O requests during the predetermined time period. For example, in some embodiments, in accordance with a determination that region 310-1 (FIG. 3) has been accessed at least once by the plurality of I/O requests during the predetermined time period, the storage device sets a flag (e.g., valid region flag 266, FIG. 2B) to “1” in the region data structure associated with region 310-1 (e.g., region data structure 244-1, FIG. 2B). In some embodiments, the flag to denote the determination of whether the region is an idle region during the predetermined time period is set for the remainder of the predetermined time period. In some embodiments, the flag to denote the determination of whether the region is an idle region during the predetermined time period remains set for a next instance of the predetermined time period. In some embodiments, a region module (e.g., region module 230, FIG. 2A) is used to set, for each region of the plurality of regions in the logical address space of the host, a flag to denote the determination of whether the region is an idle region during the predetermined time period, as described above with respect to FIG. 2A.

As discussed above, in some embodiments, flags (e.g., flags 260, FIG. 2B) are re-evaluated and set accordingly at the end of each predetermined time period based on the count values at the end of the predetermined time period. As a result, in some embodiments, flags are set based on the history of I/O requests in the current predetermined time period and/or based on the history of I/O requests in the prior predetermined time period. In one example that uses one hour time periods as the predetermined time period, a respective logical address region is determined to have been accessed at least once part-way through a one hour time period. As a result, the respective flag (e.g., valid region flag 266, FIG. 2B) for that logical address region remains set both during the remainder of the one hour time period, and also through the next one hour time period (at which point it would be re-evaluated based on activity during that next one hour time period).

In some embodiments, the storage device, for each region of the plurality of regions in the logical address space of the host, stores (628) information (e.g., data gathered regarding the plurality of I/O requests) in a data structure (e.g., history table 224, FIG. 2A) to maintain a history of I/O request patterns in the region for the predetermined time period. For example, in some embodiments, the storage device stores information in region data structure 244-1 (FIG. 2B) to maintain a history of I/O request patterns in region 310-1 (FIG. 3) for the predetermined time period. In some embodiments, maintaining a history of I/O request patterns in the region for the predetermined time period includes gathering the historical data as I/O requests are received and/or processed. For example, in some embodiments, maintaining a history of I/O request patterns in region 310-1 (FIG. 3) includes gathering the historical data as read requests from and write requests to region 310-1 are received and/or processed. In some embodiments, the information is stored in a data structure stored on the storage device (e.g., storage device 120, FIG. 1). For example, in some embodiments, the history of I/O request patterns is maintained in a history table (e.g., history table 224, FIGS. 2A and 2B) stored on the storage device (e.g., in memory 206 of management module 121 of storage controller 124 of storage device 120, FIG. 1). In some embodiments, the storage device gathers data as I/O requests are processed and stores the history of I/O request patterns and/or determinations based on the history of I/O request patterns in a history table (e.g., history table 224, FIGS. 2A and 2B) stored on the storage device. In some embodiments, the history table includes one or more data structures.

In some embodiments, one or more operations performed to gather data and/or make determinations based on the data are performed at a host (e.g., computer system 110, FIG. 1), relevant information is transmitted from the host to a storage device (e.g., storage device 120, FIG. 1), and the history of I/O request patterns is maintained in a data structure on the storage device. In some embodiments, the information is stored in a data structure stored on the host (e.g., computer system 110, FIG. 1). For example, in some embodiments, the history of I/O request patterns is maintained in a history table stored on the host. In some embodiments, the host gathers data as I/O requests are processed and stores the history of I/O request patterns and/or determinations based on the history of I/O request patterns in a history table stored on the host. In some embodiments, the history table includes one or more data structures. In some embodiments, a history maintaining module (e.g., history maintaining module 222, FIG. 2A) is used to store, for each region of the plurality of regions in the logical address space of the host, information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period, as described above with respect to FIG. 2A.

In some embodiments, some (e.g., one, some, or all) of the operations performed for each region of the plurality of regions in the logical address space of the host (e.g., determining whether a region is an idle region in order to identify idle region(s) of the plurality of regions in the logical address space) are performed at the storage device (e.g., storage device 120, FIG. 1). In some embodiments, some (e.g., one, some, or all) of the operations performed for each region of the plurality of regions in the logical address space of the host are performed at the host (e.g., computer system 110, FIG. 1). In some embodiments, one or more of the operations are performed at the storage device (e.g., storage device 120, FIG. 1) and one or more of the operations are performed at the host (e.g., computer system 110, FIG. 1). For ease of explanation, the description herein describes embodiments wherein the operations are performed at the storage device. However, in some embodiments, one or more of the operations are performed at the host and signals and/or commands are transmitted to the storage device as needed. For example, in some embodiments, maintaining a history of I/O request patterns in the region for a predetermined time period and/or making determinations based on the history of I/O request patterns (e.g., determining whether a region is an idle region in order to identify idle region(s) of the plurality of regions in the logical address space) is performed at the host and one or more signals (e.g., a command, a flag, etc.) are transmitted by the host to the storage device to either adjust subsequent I/O processing in the region or to communicate to the storage device one or more aspects of the history of I/O request patterns in the region.

In some embodiments, any of the methods described above are performed by a storage device, the storage device including (1) one or more processors, and (2) memory storing one or more programs, which when executed by the one or more processors cause the storage device to perform or control performance of any of the methods described herein.

In some embodiments, any of the methods described above are performed by a storage system comprising (1) a storage medium (e.g., comprising one or more non-volatile storage devices, such as flash memory devices) (2) one or more processors, and (3) memory storing one or more programs, which when executed by the one or more processors cause the storage system to perform or control performance of any of the methods described herein.

Semiconductor memory devices include volatile memory devices, such as dynamic random access memory (“DRAM”) or static random access memory (“SRAM”) devices, non-volatile memory devices, such as resistive random access memory (“ReRAM”), electrically erasable programmable read only memory (“EEPROM”), flash memory (which can also be considered a subset of EEPROM), ferroelectric random access memory (“FRAM”), and magnetoresistive random access memory (“MRAM”), and other semiconductor elements capable of storing information. Each type of memory device may have different configurations. For example, flash memory devices may be configured in a NAND or a NOR configuration.

The memory devices can be formed from passive and/or active elements, in any combinations. By way of non-limiting example, passive semiconductor memory elements include ReRAM device elements, which in some embodiments include a resistivity switching storage element, such as an anti-fuse, phase change material, etc., and optionally a steering element, such as a diode, etc. Further by way of non-limiting example, active semiconductor memory elements include EEPROM and flash memory device elements, which in some embodiments include elements containing a charge storage region, such as a floating gate, conductive nanoparticles, or a charge storage dielectric material.

Multiple memory elements may be configured so that they are connected in series or so that each element is individually accessible. By way of non-limiting example, flash memory devices in a NAND configuration (NAND memory) typically contain memory elements connected in series. A NAND memory array may be configured so that the array is composed of multiple strings of memory in which a string is composed of multiple memory elements sharing a single bit line and accessed as a group. Alternatively, memory elements may be configured so that each element is individually accessible (e.g., a NOR memory array). NAND and NOR memory configurations are exemplary, and memory elements may be otherwise configured.

The semiconductor memory elements located within and/or over a substrate may be arranged in two or three dimensions, such as a two dimensional memory structure or a three dimensional memory structure.

In a two dimensional memory structure, the semiconductor memory elements are arranged in a single plane or a single memory device level. Typically, in a two dimensional memory structure, memory elements are arranged in a plane (e.g., in an x-z direction plane) which extends substantially parallel to a major surface of a substrate that supports the memory elements. The substrate may be a wafer over or in which the layer of the memory elements are formed or it may be a carrier substrate which is attached to the memory elements after they are formed. As a non-limiting example, the substrate may include a semiconductor such as silicon.

The memory elements may be arranged in the single memory device level in an ordered array, such as in a plurality of rows and/or columns. However, the memory elements may be arrayed in non-regular or non-orthogonal configurations. The memory elements may each have two or more electrodes or contact lines, such as bit lines and word lines.

A three dimensional memory array is arranged so that memory elements occupy multiple planes or multiple memory device levels, thereby forming a structure in three dimensions (i.e., in the x, y and z directions, where the y direction is substantially perpendicular and the x and z directions are substantially parallel to the major surface of the substrate).

As a non-limiting example, a three dimensional memory structure may be vertically arranged as a stack of multiple two dimensional memory device levels. As another non-limiting example, a three dimensional memory array may be arranged as multiple vertical columns (e.g., columns extending substantially perpendicular to the major surface of the substrate, i.e., in the y direction) with each column having multiple memory elements in each column. The columns may be arranged in a two dimensional configuration (e.g., in an x-z plane), resulting in a three dimensional arrangement of memory elements with elements on multiple vertically stacked memory planes. Other configurations of memory elements in three dimensions can also constitute a three dimensional memory array.

By way of non-limiting example, in a three dimensional NAND memory array, the memory elements may be coupled together to form a NAND string within a single horizontal (e.g., x-z) memory device level. Alternatively, the memory elements may be coupled together to form a vertical NAND string that traverses across multiple horizontal memory device levels. Other three dimensional configurations can be envisioned wherein some NAND strings contain memory elements in a single memory level while other strings contain memory elements which span through multiple memory levels. Three dimensional memory arrays may also be designed in a NOR configuration and in a ReRAM configuration.

Typically, in a monolithic three dimensional memory array, one or more memory device levels are formed above a single substrate. Optionally, the monolithic three dimensional memory array may also have one or more memory layers at least partially within the single substrate. As a non-limiting example, the substrate may include a semiconductor such as silicon. In a monolithic three dimensional array, the layers constituting each memory device level of the array are typically formed on the layers of the underlying memory device levels of the array. However, layers of adjacent memory device levels of a monolithic three dimensional memory array may be shared or have intervening layers between memory device levels.

Then again, two dimensional arrays may be formed separately and then packaged together to form a non-monolithic memory device having multiple layers of memory. For example, non-monolithic stacked memories can be constructed by forming memory levels on separate substrates and then stacking the memory levels atop each other. The substrates may be thinned or removed from the memory device levels before stacking, but as the memory device levels are initially formed over separate substrates, the resulting memory arrays are not monolithic three dimensional memory arrays. Further, multiple two dimensional memory arrays or three dimensional memory arrays (monolithic or non-monolithic) may be formed on separate chips and then packaged together to form a stacked-chip memory device.

Associated circuitry is typically required for operation of the memory elements and for communication with the memory elements. As non-limiting examples, memory devices may have circuitry used for controlling and driving memory elements to accomplish functions such as programming and reading. This associated circuitry may be on the same substrate as the memory elements and/or on a separate substrate. For example, a controller for memory read-write operations may be located on a separate controller chip and/or on the same substrate as the memory elements.

The term “three-dimensional memory device” (or 3D memory device) is herein defined to mean a memory device having multiple memory layers or multiple levels (e.g., sometimes called multiple memory device levels) of memory elements, including any of the following: a memory device having a monolithic or non-monolithic 3D memory array, some non-limiting examples of which are described above; or two or more 2D and/or 3D memory devices, packaged together to form a stacked-chip memory device, some non-limiting examples of which are described above.

One of skill in the art will recognize that this invention is not limited to the two dimensional and three dimensional exemplary structures described but cover all relevant memory structures within the spirit and scope of the invention as described herein and as understood by one of skill in the art.

It will be understood that, although the terms “first,” “second,” etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first region could be termed a second region, and, similarly, a second region could be termed a first region, without changing the meaning of the description, so long as all occurrences of the “first region” are renamed consistently and all occurrences of the “second region” are renamed consistently. The first region and the second region are both regions, but they are not the same region.

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the claims. As used in the description of the embodiments and the appended claims, the singular forms “a,” “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term “and/or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

As used herein, the term “if” may be construed to mean “when” or “upon” or “in response to determining” or “in accordance with a determination” or “in response to detecting,” that a stated condition precedent is true, depending on the context. Similarly, the phrase “if it is determined [that a stated condition precedent is true]” or “if [a stated condition precedent is true]” or “when [a stated condition precedent is true]” may be construed to mean “upon determining” or “in response to determining” or “in accordance with a determination” or “upon detecting” or “in response to detecting” that the stated condition precedent is true, depending on the context.

The foregoing description, for purpose of explanation, has been described with reference to specific embodiments. However, the illustrative discussions above are not intended to be exhaustive or to limit the claims to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The embodiments were chosen and described in order to best explain principles of operation and practical applications, to thereby enable others skilled in the art. 

What is claimed is:
 1. A method performed by a storage device having a storage medium and a storage controller, the method comprising: receiving, at the storage device, over a predetermined time period, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of predefined regions in a logical address space of the host; in accordance with the plurality of I/O requests received over the predetermined time period, performing at the storage controller of the storage device a set of operations, including: identifying an idle logical address space region of the plurality of predefined regions in the logical address space of the host, wherein: identifying the idle logical address space region comprises identifying a region, of the plurality of predefined regions in the logical address space of the host, that has not been accessed at least once by the plurality of I/O requests during the predetermined time period, the logical address space of the host includes logical block addresses organized in numerical order, and each region in the logical address space of the host, including the identified idle logical address space region, includes a plurality of the logical block addresses; and in accordance with the identification of the idle logical address space region, which is a respective predefined region of the plurality of predefined regions in the logical address space of the host: identifying one or more data storage blocks, in the storage medium, that store data in the identified idle logical address space region, wherein identifying the one or more data storage blocks comprises mapping one or more logical addresses in the idle logical address space region to physical addresses in a physical address space of the storage device, and enabling garbage collection of the identified data storage blocks, in the storage medium of the storage device.
 2. The method of claim 1, further comprising: identifying a subset of the identified one or more data storage blocks, in the storage medium, that satisfy predefined garbage collection criteria, and initiating garbage collection of the identified subset of the identified one or more data storage blocks.
 3. The method of claim 2, further comprising: determining whether a respective bank of a plurality of banks in the storage medium is participating in garbage collection; and in accordance with a determination that the respective bank is not participating in garbage collection, allocating blocks from the respective bank for subsequent write requests.
 4. The method of claim 3, wherein each bank of the plurality of banks comprises a plurality of data storage blocks, and the respective bank is not participating in garbage collection of any of the identified one or more data storage blocks.
 5. The method of claim 1, further comprising, for each region of the plurality of predefined regions in the logical address space of the host, setting a flag to denote a determination of whether the region is an idle logical address space region during the predetermined time period.
 6. The method of claim 1, further comprising, for each region of the plurality of predefined regions in the logical address space of the host, storing information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period.
 7. The method of claim 1, wherein the predetermined time period is configurable.
 8. The method of claim 1, wherein the storage device comprises one or more flash memory devices.
 9. The method of claim 1, wherein the storage device comprises one or more three-dimensional (3D) memory devices and circuitry associated with operation of memory elements in the one or more 3D memory devices.
 10. The method of claim 9, wherein the circuitry and one or more memory elements in a respective 3D memory device, of the one or more 3D memory devices, are on the same substrate.
 11. A storage device, comprising: a storage medium; a storage controller that includes one or more processors; and memory storing one or more programs, which when executed by the one or more processors cause the storage device to: receive, at the storage device, over a predetermined time period, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of predefined regions in a logical address space of the host; at the storage controller, in accordance with the plurality of I/O requests received over the predetermined time period: identify an idle logical address space region of the plurality of predefined regions in the logical address space of the host, wherein: identifying the idle logical address space region comprises identifying a region, of the plurality of predefined regions in the logical address space of the host, that has not been accessed at least once by the plurality of I/O requests during the predetermined time period, the logical address space of the host includes logical block addresses organized in numerical order, and each region in the logical address space of the host, including the identified idle logical address space region, includes a plurality of the logical block addresses; and in accordance with the identification of the idle logical address space region, which is a respective predefined region of the plurality of predefined regions in the logical address space of the host: identify one or more data storage blocks, in the storage medium, that store data having logical addresses in the identified idle logical address space region, wherein identifying the one or more data storage blocks comprises mapping one or more logical addresses in the idle logical address space region to physical addresses in a physical address space of the storage system, and enable garbage collection of the identified data storage blocks, in the storage medium of the storage device.
 12. The storage device of claim 11, wherein the one or more programs, which when executed by the one or more processors, further cause the storage device to: identify a subset of the identified one or more data storage blocks, in the storage medium, that satisfy predefined garbage collection criteria, and initiate garbage collection of the identified subset of the identified one or more data storage blocks.
 13. The storage device of claim 12, wherein the one or more programs, which when executed by the one or more processors, further cause the storage device to: determine whether a respective bank of a plurality of banks in the storage medium is participating in garbage collection; and in accordance with a determination that the respective bank is not participating in garbage collection, allocate blocks from the respective bank for subsequent write requests.
 14. The storage device of claim 11, wherein the one or more programs, which when executed by the one or more processors, further cause the storage device to: for each region of the plurality of predefined regions in the logical address space of the host, store information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period.
 15. A storage system, comprising: a storage medium; a storage controller that includes one or more processors; and memory storing one or more programs, which when executed by the one or more processors cause the storage system to: receive, at a storage system, over a predetermined time period, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of predefined regions in a logical address space of the host; at the storage controller, in accordance with the plurality of I/O requests received over the predetermined time period: identify an idle logical address space region of the plurality of predefined regions in the logical address space of the host, wherein: identifying the idle logical address space region comprises identifying a region, of the plurality of predefined regions in the logical address space of the host, that has not been accessed at least once by the plurality of I/O requests during the predetermined time period, the logical address space of the host includes logical block addresses organized in numerical order, and each region in the logical address space of the host, including the identified idle logical address space region, includes a plurality of the logical block addresses; and in accordance with the identification of the idle logical address space region, which is a respective predefined region of the plurality of predefined regions in the logical address space of the host: identify one or more data storage blocks, in the storage medium, that store data having logical addresses in the identified idle logical address space region, wherein identifying the one or more data storage blocks comprises mapping one or more logical addresses in the idle logical address space region to physical addresses in a physical address space of the storage system, and enable garbage collection of the identified data storage blocks, in the storage medium of the storage system.
 16. A non-transitory computer readable storage medium, storing one or more programs configured for execution by one or more processors of a storage controller of a storage device, the one or more programs including instructions for: receiving, at the storage device, a plurality of input/output (I/O) requests from a host, the plurality of I/O requests including read requests and write requests to be performed in a plurality of predefined regions in a logical address space of the host; at the storage controller, in accordance with the plurality of I/O requests received over the predetermined time period: identifying an idle logical address space region of the plurality of predefined regions in the logical address space of the host, wherein: identifying the idle logical address space region comprises identifying a region, of the plurality of predefined regions in the logical address space of the host, that has not been accessed at least once by the plurality of I/O requests during the predetermined time period, the logical address space of the host includes logical block addresses organized in numerical order, and each region in the logical address space of the host, including the identified idle logical address space region, includes a plurality of the logical block addresses; and in accordance with the identification of the idle logical address space region, which is a respective predefined region of the plurality of predefined regions in the logical address space of the host: identifying one or more data storage blocks, in a storage medium of the storage device, that store data having logical addresses in the identified idle logical address space region, wherein identifying the one or more data storage blocks comprises mapping one or more logical addresses in the idle logical address space region to physical addresses in a physical address space of the storage device, and enabling garbage collection of the identified data storage blocks, in the storage medium of the storage device.
 17. The non-transitory computer readable storage medium of claim 16, wherein the one or more programs further include instructions for: identifying a subset of the identified one or more data storage blocks, in the storage medium, that satisfy predefined garbage collection criteria, and initiating garbage collection of the identified subset of the identified one or more data storage blocks.
 18. The non-transitory computer readable storage medium of claim 17, wherein the one or more programs further include instructions for: determining whether a respective bank of a plurality of banks in the storage medium of the storage device is participating in garbage collection; and in accordance with a determination that the respective bank is not participating in garbage collection, allocating blocks from the respective bank for subsequent write requests.
 19. The non-transitory computer readable storage medium of claim 16, wherein the one or more programs further include instructions for: for each region of the plurality of predefined regions in the logical address space of the host, storing information in a data structure to maintain a history of I/O request patterns in the region for the predetermined time period. 